<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
           // 有一个对象 来判断是否有该属性 对象['属性名']

           let obj = {
            age: 18,
            sex: true
           }
         let temp = prompt("请输入年龄或性别")
         if (obj[temp]){
            console.log('ok');
         }else{
            console.log('no');
         }
           // 判断一个字符串 'abcoefoxyozzopp' 中出现次数最多的字符，并统计其次数。
        /* 
            对象 info
            info.a = 1
            info.b = 1
            info.c = 1
            info.o = 2
        */
       let result = prompt('请输入字符');
       let info = {};
       for (let i = 0; i < result.length; i++) {
      let char = result[i];

      if (info[char]) {
        info[char]++;
      }else{
        info[char] = 1;
      }
        
       }
console.log(info);
 // 遍历对象的属性和值
 let max = 0;
        let ch = '';
        for (let k in info) {
            console.log(k, info[k]);

            if (info[k] > max) {
                max = info[k];
                ch = k;
            }
        }
        console.log(ch, max);
     
    </script>
</body>
</html>